package eco2automotive.gui.actions;
import java.awt.event.*;
import eco2automotive.port.Connection;
import eco2automotive.gui.components.Panel_PORT_FINDER;
import eco2automotive.gui.components.Panel_PORT_INFO;
/** 
  * @version 1.0
  * @autor Fco. Javier Sánchez Esparza
 */
public class Act_btn_PORT_SELECT implements ActionListener{

   Connection conn;
   Panel_PORT_FINDER PORT_FINDER;
   Panel_PORT_INFO PORT_INFO;
   /**
    * Actions params
    * @param CONN Connection values
    * @param PORT_FINDER Display the ports availabe
    * @param INFO Display the Connection values
    */
   public Act_btn_PORT_SELECT(Connection CONN, Panel_PORT_FINDER PORT_FINDER, 
            Panel_PORT_INFO INFO){              
         this.conn=CONN; 
         this.PORT_FINDER=PORT_FINDER;
         this.PORT_INFO=INFO;
    }    
    public void actionPerformed(ActionEvent e) 
    {          
        start(); 
    }
    /**
     * Set the Port name selected
     * 
     */
    public void start(){        
        conn.setPortName(PORT_FINDER.getSelectedName());
        this.PORT_INFO.setPortName(conn.getNombrePuerto());        
    }
}
